<div class="multi-level-container">
  <div class="level-0" ng-repeat="level0 in sourceData[aggs[0]].buckets">
    <div class="level-row">
      <div class="level-row-name" ng-click="level0.show = !level0.show">{{level0.show?'v':'^'}}{{level0.key}}</div>
      <div class="level-row-count">{{level0.doc_count}}</div>
    </div>
    <div class="level-1" ng-repeat="level1 in level0[aggs[1]].buckets" ng-if="level0.show">
      <div class="level-row">
        <div class="level-row-name" ng-click="level1.show = !level1.show">{{level1.show?'v':'^'}}{{level1.key}}</div>
        <div class="level-row-count">{{level1.doc_count}}</div>
      </div>
      <div class="level-2" ng-repeat="level2 in level1[aggs[2]].buckets" ng-if="level1.show">
        <div class="level-row">
          <div class="level-row-name" ng-click="level2.show = !level2.show">{{level2.show?'v':'^'}}{{level2.key}}</div>
          <div class="level-row-count">{{level2.doc_count}}</div>
        </div>
        <div class="level-3" ng-repeat="level3 in level2[aggs[3]].buckets" ng-if="level2.show">
          <div class="level-row">
            <div class="level-row-name" ng-click="level3.show = !level3.show">{{level3.show?'v':'^'}}{{level3.key}}
            </div>
            <div class="level-row-count">{{level3.doc_count}}</div>
          </div>
          <div ng-if="level3.show">
            <table class="ui table">
              <thead>
                <tr>
                  <th>1</th>
                </tr>
              </thead>
              <tbody>
                <tr ng-repeat="item in level3.top_hits.hits.hits">
                  <td>{{item._source.event_name}}</td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>